package com.wza.designPattern.AbstructFactoryPattern;

/**
 * <一句话功能简述>
 * <功能详细描述>
 *
 * @author Administrator
 * @version [版本号, 2018/11/20]
 * @see [相关类/方法]
 * @since [产品/模块版本]
 */
public class AbstructFactoryProvider
{
    public static AbstractFactory getFactory(String factoryName)
    {
        if (factoryName == null)
        {
            System.out.println("factoryName is null!");
            return null;
        }

        if ("SHAPE".equalsIgnoreCase(factoryName))
        {
            return new ShapeFactory();
        }
        else if ("COLOR".equalsIgnoreCase(factoryName))
        {
            return new ColorFactory();
        }
        else
        {
            System.out.println("Unknown FactoryName !");
        }

        return null;
    }
}
